package net.lab1024.sa.admin.module.business.summary.controller;

import net.lab1024.sa.admin.module.business.summary.domain.form.SummaryInfoAddForm;
import net.lab1024.sa.admin.module.business.summary.domain.form.SummaryInfoQueryForm;
import net.lab1024.sa.admin.module.business.summary.domain.form.SummaryInfoUpdateForm;
import net.lab1024.sa.admin.module.business.summary.domain.vo.SummaryInfoVO;
import net.lab1024.sa.admin.module.business.summary.service.SummaryInfoService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;

/**
 * 报价单汇总 - 一条对应多个报价单 Controller
 *
 * @Author zzx
 * @Date 2025-08-30 15:49:03
 * @Copyright zzx
 */

@RestController
@Tag(name = "报价单汇总 - 一条对应多个报价单")
public class SummaryInfoController {

    @Resource
    private SummaryInfoService summaryInfoService;

    @Operation(summary = "分页查询 @author zzx")
    @PostMapping("/summaryInfo/queryPage")
    @SaCheckPermission("summaryInfo:query")
    public ResponseDTO<PageResult<SummaryInfoVO>> queryPage(@RequestBody @Valid SummaryInfoQueryForm queryForm) {
        return ResponseDTO.ok(summaryInfoService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author zzx")
    @PostMapping("/summaryInfo/add")
    @SaCheckPermission("summaryInfo:add")
    public ResponseDTO<String> add(@RequestBody @Valid SummaryInfoAddForm addForm) {
        return summaryInfoService.add(addForm);
    }

    @Operation(summary = "更新 @author zzx")
    @PostMapping("/summaryInfo/update")
    @SaCheckPermission("summaryInfo:update")
    public ResponseDTO<String> update(@RequestBody @Valid SummaryInfoUpdateForm updateForm) {
        return summaryInfoService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author zzx")
    @PostMapping("/summaryInfo/batchDelete")
    @SaCheckPermission("summaryInfo:delete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return summaryInfoService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author zzx")
    @GetMapping("/summaryInfo/delete/{summaryId}")
    @SaCheckPermission("summaryInfo:delete")
    public ResponseDTO<String> batchDelete(@PathVariable Long summaryId) {
        return summaryInfoService.delete(summaryId);
    }
}
